{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="think-box-shadow">
    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">

    </form>
    <table class="layui-table margin-top-10" lay-filter="mxTable" lay-skin="line" id="mxTable">
    </table>
    <script type="text/html" id="toolbarDemo">
<!--        <button class="layui-btn layui-btn-sm layui-btn-normal " lay-event="subt" type="button">确认</button>-->
    </script>
    <script type="text/html" id="actionBar">
                <button class="layui-btn layui-btn-sm layui-btn-danger " lay-event="oncancel" type="button">撤销</button>
</script>
</div>
{/block}
{block name="script"}
<!-- /主体 -->
<script>
    const moduleInit = ['tool'];
    function gouguInit() {
        var form =layui.form;

        var treeTable = layui.table;
        var tableIns = treeTable.render({
            elem: '#mxTable'
            , url: "{:url('seeLock')}?id={$id}"
            , method: 'post'
            , toolbar: '#toolbarDemo',
            defaultToolbar: []
            , cellMinWidth: 80
            , cols: [[
                // {type: 'checkbox', fixed: 'left'},
                // {fixed: 'left', field: 'id', title: 'ID', unresize: true, hide: true}
                // ,{field: 'id', width: 80, title: 'ID号', align: 'center'},
                 {field: 'orderNum', fixed: 'left', title: '销售合同'}
                , {field: 'lockNum', title: '锁定数量'}
                // , {title: '操作',fixed: 'right',width: 200,  align: 'center'
                //     , toolbar: '#actionBar'
                // }
            ]]
            , page: true
        });
        treeTable.on('tool(mxTable)', function (obj) {
            var checkStatus = treeTable.checkStatus(obj.config.id);
            console.log('ddd',obj.data)
            switch (obj.event) {
                case 'oncancel':
                    httpRequest("{:url('cancelLock')}",{id:obj.data.id},function (res) {
                        if (res.code == 0) {
                            tableIns.reload();
                        }
                    })
                    break;

            }
            ;
        })
        form.on('submit(webform)', function (data) {
            tableIns.reload({
                where: data.field,
                page: {
                    curr: 1
                }
            });
            return false;
        });

    }

</script>
<!-- 脚本 -->
{/block}


